home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 22
/
PC Gamer IT CD 22.iso
/
DEMOS
/
DC
/
Setup.rul
< prev
next >
Wrap
Text File
|
1997-06-02
|
12KB
|
316 lines
declare
#include "sddialog.h"
// This is the latest and greatest 5/13/97
// NOTE: IN THIS NEW SETUP.RUL NOTICE THAT YOU MAY CHANGE WANT_README &
// NEED_DIRECTX. YOU WILL NEED A README.TXT IN ALL OF YOUR ARCHIVES FOR
// IT TO WORK. YOU WILL NEED A REDIST FOLDER FOR DIRECTX. THERE IS A
// REDIST FOLDER IN \SHARED\REDIST.
// This is a template that many installs can be made from
// Change any of the following lines to read how you would like to see them
// Make sure the "NUMBER_OF_INSTALL_OPTIONS is correctly set, for example
// Necrodome has a Standard Install and a Full Install, for a total of 2
// install options.
#define YES_I_DO 1 // DO NOT CHANGE
#define NO_I_DONT 0 // DO NOT CHANGE
#define WANT_README YES_I_DO //add readme to all archives first,second,etc.
#define NEED_DIRECTX YES_I_DO //have a redist folder on root of CD
#define WANT_AUTORUN NO_I_DONT
#define WANT_A_SHORTCUT YES_I_DO
#define WANT_A_SLIDESHOW NO_I_DONT
#define SPACE_FOR_FIRST 4700000 // size in bytes
#define SPACE_FOR_SECOND 0
#define SPACE_FOR_THIRD 0
#define SPACE_FOR_FOURTH 0
#define SPACE_FOR_FIFTH 0
#define COMPANY_NAME "Strategic Simulations Inc."
#define PRODUCT_NAME "Dark Colony"
#define PRODUCT_VERSION "Demo"
#define GAME_EXE_NAME "DC.exe"
#define DEFAULT_DIRECTORY "C:\\Program Files\\Dark Colony Demo" // make sure to use "\\" for "\"
#define DEINSTALL_KEY "DCDemoDeinstallKey" // A unique string is needed for each game
#define SELECT_INSTALL_OPTIONS "" // title of install option window
#define TOP_SELECT_MESSAGE ""
#define BOTTOM_SELECT_MESSAGE "You will need 46 MB free on your hard drive."
#define FIRST_INSTALL_OPTION ""
#define SECOND_INSTALL_OPTION ""
#define THIRD_INSTALL_OPTION ""
#define FOURTH_INSTALL_OPTION ""
#define FIFTH_INSTALL_OPTION ""
#define NUMBER_OF_INSTALL_OPTIONS 1 // important: games without options = 1
#define FIRST_ARCHIVE "first.z" // names of the archives that
#define SECOND_ARCHIVE ""
#define THIRD_ARCHIVE ""
#define FOURTH_ARCHIVE "" // them match your ICOMP
#define FIFTH_ARCHIVE "" // archives.
// Start Main Program, modifications should be done with programmer supervision
STRING szKey, szShortCut, szMsg, szTitle, szTemp, szDir, svDir, svUninstLogFile, szId, szComponents, svResult,
szParam,szProgram,szFileSet,szProgCall,szConfigLine,szConfigLine2, szMsg1, szMsg2,
szFileSet2, szCommandLine, szDir1, szFolderName, szDefFolder, szBitmap;
NUMBER nReturn, nResult, nvFileHandle, nExclusiveFlag, nSpaceRequired, nInstall;
BOOL bSpaceOk;
prototype SetupScreen();
prototype _Perform( STRING );
program
StartHere:
Disable( BACKGROUND );
nSpaceRequired = SPACE_FOR_FIRST;
GetSystemInfo( OS, nResult, svResult );
if ((nResult = IS_WINDOWSNT) && (NEED_DIRECTX = YES_I_DO)) then
MessageBox("Windows NT has been detected.\n\n" +
"This is a Windows 95 game that will\n" +
"not run on Windows NT.", SEVERE);
goto theEnd;
endif;
// Set installation info., which is required for registry entries.
InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, GAME_EXE_NAME );
SetupScreen();
Enable( DIALOGCACHE );
beginInstall:
SdProductName( PRODUCT_NAME );
szTitle = PRODUCT_NAME;
szMsg = "";
Disable (BACKBUTTON);
SdWelcome ( szTitle, szMsg );
Enable (BACKBUTTON);
if (NUMBER_OF_INSTALL_OPTIONS = 1) then
nInstall = 1;
goto getdir;
endif;
getOption:
szTitle = SELECT_INSTALL_OPTIONS;
szMsg1 = TOP_SELECT_MESSAGE;
szMsg2 = BOTTOM_SELECT_MESSAGE;
szId = "";
szComponents = FIRST_INSTALL_OPTION;
ComponentAddItem(szComponents, FIRST_INSTALL_OPTION, SPACE_FOR_FIRST, TRUE);
ComponentAddItem(szComponents, SECOND_INSTALL_OPTION, SPACE_FOR_SECOND, FALSE);
if (NUMBER_OF_INSTALL_OPTIONS > 2) then
ComponentAddItem(szComponents, THIRD_INSTALL_OPTION, SPACE_FOR_THIRD, FALSE);
endif;
if (NUMBER_OF_INSTALL_OPTIONS > 3) then
ComponentAddItem(szComponents, FOURTH_INSTALL_OPTION, SPACE_FOR_FOURTH, FALSE);
endif;
if (NUMBER_OF_INSTALL_OPTIONS = 5) then
ComponentAddItem(szComponents, FIFTH_INSTALL_OPTION, SPACE_FOR_FIFTH, FALSE);
endif;
nExclusiveFlag = EXCLUSIVE;
nReturn = SdAskOptions ( szTitle, szMsg1, szMsg2, szId, szComponents, nExclusiveFlag);
if (nReturn = BACK) then
goto beginInstall;
endif;
if ComponentIsItemSelected(szComponents,FIRST_INSTALL_OPTION) then
nInstall = 1;
nSpaceRequired = SPACE_FOR_FIRST;
elseif ComponentIsItemSelected(szComponents,SECOND_INSTALL_OPTION) then
nInstall = 2;
nSpaceRequired = SPACE_FOR_SECOND;
elseif (NUMBER_OF_INSTALL_OPTIONS > 2) then
if ComponentIsItemSelected(szComponents, THIRD_INSTALL_OPTION) then
nInstall = 3;
nSpaceRequired = SPACE_FOR_THIRD;
endif;
elseif (NUMBER_OF_INSTALL_OPTIONS > 3) then
if ComponentIsItemSelected(szComponents, FOURTH_INSTALL_OPTION) then
nInstall = 4;
nSpaceRequired = SPACE_FOR_FOURTH;
endif;
elseif (NUMBER_OF_INSTALL_OPTIONS = 5) then
if ComponentIsItemSelected(szComponents, FIFTH_INSTALL_OPTION) then
nInstall = 5;
nSpaceRequired = SPACE_FOR_FIFTH;
endif;
endif;
getdir:
szTitle = "";
svDir = DEFAULT_DIRECTORY;
szMsg = "";
nReturn = SdAskDestPath (szTitle, szMsg, svDir, STYLE_NORMAL);
if ( nReturn = NEXT ) then
if ( ExistsDir ( svDir ) = NOTEXISTS ) then
szTitle = "Confirm Newly Selected Directory";
szDir = svDir;
nResult = SdConfirmNewDir (szTitle, szDir, STYLE_NORMAL);
if (nResult < 0) then
SprintfBox( SEVERE, "ERROR",
"Error creating the directory '%s'\n" +
"Installation is incomplete!",szDir );
exit;
elseif (nResult = NO) then
MessageBox( "Directory not created.\n" +
"Installation is incomplete! ", SEVERE);
exit;
endif;
bSpaceOk = TRUE;
if (GetDiskSpace( svDir ) < nSpaceRequired) then
szMsg = "There is not enough space available on the disk\n" +
"'" + svDir + "' \n" +
"Please free up some space or change the target location\n" +
"to a different disk";
MessageBox( szMsg, WARNING );
bSpaceOk = FALSE;
endif;
if (bSpaceOk = FALSE) goto getdir;
endif;
else
if (NUMBER_OF_INSTALL_OPTIONS > 1) then // back button
goto getOption;
else
goto beginInstall;
endif;
endif;
RegDBSetItem( REGDB_APPPATH, svDir );
szProgram = svDir ^ GAME_EXE_NAME;
RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
szFolderName = PRODUCT_NAME;
szDir1 = svDir;
LongPathToQuote ( szDir1, TRUE );
TransferFiles:
if (WANT_AUTORUN = YES_I_DO) then
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
szKey = "\\SOFTWARE" ^ COMPANY_NAME ^ PRODUCT_NAME ^ PRODUCT_VERSION;
if (RegDBCreateKeyEx(szKey,"") < 0) then
MessageBox("Register error!",SEVERE);
endif;
RegDBSetKeyValueEx(szKey,"DIRECTORY",REGDB_STRING,svDir,-1);
endif;
// Prepare InstallShield to record deinstallation information.
DeinstallStart( svDir, svUninstLogFile, DEINSTALL_KEY, 0 );
RegDBSetItem( REGDB_UNINSTALL_NAME, PRODUCT_NAME );
switch (nInstall)
case 1:
_Perform ("one");
case 2:
_Perform ("two");
case 3:
_Perform ("three");
case 4:
_Perform ("four");
case 5:
_Perform ("five");
endswitch;
switch (nResult)
case FS_DONE: // Successful completion.
case FS_CREATEDIR: // Create directory error.
MessageBox( "Unable to create a directory under " + TARGETDIR + "."+
"Please check write access to this directory.", SEVERE );
exit;
default: // Group all other errors under default label.
NumToStr( szTemp, nResult );
MessageBox( "General file transfer error.\n" +
"Please check your target location and try again."+
"\n\n Error Number:"+szTemp +
"\n Related File: "+ERRORFILENAME,
SEVERE );
exit;
endswitch;
if (WANT_A_SHORTCUT = YES_I_DO) then
szShortCut = svDir ^ GAME_EXE_NAME;
LongPathToQuote(szShortCut,TRUE);
AddFolderIcon ( "", PRODUCT_NAME, szShortCut, svDir, "", 0, "", REPLACE );
endif;
if (NEED_DIRECTX = YES_I_DO) then
SetDialogTitle(DLG_ASK_YESNO,"Install complete");
nResult = AskYesNo("IMPORTANT: " + PRODUCT_NAME +" requires DirectX 3 drivers.\n" +
"Would you like to run the DirectX 3 install now?", YES);
if (nResult = YES) then
szProgCall = SRCDISK ^ "redist\\dinstall.exe";
LaunchApp(szProgCall,""); // direct X
endif;
endif;
if (WANT_README = YES_I_DO) then
SetDialogTitle(DLG_ASK_YESNO,"Readme");
nResult = AskYesNo("Would you like to read the README file now?",YES);
if (nResult = YES) then
szProgram = "NOTEPAD.EXE";
szParam = svDir ^ "README.TXT";
LongPathToShortPath( szParam );
LaunchAppAndWait( szProgram + " " + szParam, "", NOWAIT );
Delay(2);
endif;
endif;
theEnd:
exit;
function SetupScreen()
number nDx, nDy;
begin
GetExtents( nDx, nDy );
Enable( FULLWINDOWMODE );
Enable( INDVFILESTATUS );
Enable( BITMAP256COLORS );
SetTitle( "Installing " + PRODUCT_NAME, 28, WHITE );
if (WANT_A_SLIDESHOW = YES_I_DO) then
SetColor( BACKGROUND, BK_SOLIDBLACK);
else
SetColor( BACKGROUND, BK_BLUE ); // Dark blue dittered.
SetColor( STATUSBAR, BLUE ); // Bright blue.
endif;
// SizeWindow( BACKGROUND, 640, 480 );
// PlaceWindow ( BACKGROUND, CENTERED, CENTERED, CENTERED );
SetTitle( PRODUCT_NAME, 0, BACKGROUNDCAPTION ); // Caption bar text.
Enable ( BACKGROUND );
Delay( 1 );
end;
function _Perform ( szFileSet )
STRING sztemp;
begin
FileSetBeginDefine ( szFileSet );
TARGETDIR = svDir;
if (StrCompare(szFileSet, "one") = 0) then
sztemp = FIRST_ARCHIVE;
endif;
if (StrCompare(szFileSet, "two") = 0) then
sztemp = SECOND_ARCHIVE;
endif;
if (StrCompare(szFileSet, "three") = 0) then
sztemp = THIRD_ARCHIVE;
endif;
if (StrCompare(szFileSet, "four") = 0) then
sztemp = FOURTH_ARCHIVE;
endif;
if (StrCompare(szFileSet, "five") = 0) then
sztemp = FIFTH_ARCHIVE;
endif;
if (WANT_A_SLIDESHOW = YES_I_DO) then
Disable (STATUS);
else
Enable ( STATUS );
SetStatusWindow ( 0, "Decompressing files." );
endif;
CompressGet( sztemp, "*.*", INCLUDE_SUBDIR );
FileSetEndDefine ( szFileSet );
SetStatusWindow ( 0, "Copying files." );
StatusUpdate ( ON, 100 );
nResult = FileSetPerformEz ( szFileSet, 0 );
end;
#include "sddialog.rul"